package com.celer.flex.controller;

import com.celer.flex.entity.TradeLog;
import com.celer.flex.service.TradeLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@RequestMapping("/trade")
public class TradeController {
    private final TradeLogService  tradeLogService;

    @PostMapping("/log/save")
    public TradeLog save(@RequestBody TradeLog tradeLog){
        return tradeLogService.saveLog(tradeLog);
    }

    @PostMapping("/log/del")
    public boolean delLog(@RequestBody TradeLog tradeLog){
        return tradeLogService.removeById(tradeLog);
    }
}
